<template>
  <div class="container">
      <Music-item v-for="item of mores" :item="item" :key="item.id"></Music-item>
  </div>
</template>

<script>
import HomeHttp from '../../models/HomeHttp'
import MusicItem from '../../components/music/MusicItem.vue'
export default {
    data() {
        return {
            mores:[]
        }
    },
    components:{
        MusicItem
    },
    async activated(){
     var {value} =this.$route.query;
     var fn = this.handleQuery(value);
     var res = await HomeHttp[fn]();
     console.log(res);
     var {playlists,ablums,result}=res.data;
     if(playlists){
         this.mores = playlists
     }else if(ablums){
         this.mores = ablums
     }else if(result){
         this.mores = result
     }
   },
    methods:{
        handleQuery(value){
            if(value == "Hots"){
                return "getHotMusic"
            }else if(value =="News"){
                return "getNewMusic"
            }else if(value == "DJs"){
                return "getDj"
            }
        }
    }
}
</script>

<style>

</style>